using System;
using System.Collections.Generic;
using UnityEngine;

public class KineticAnimationInfoDB : ScriptableObjectSingleton<KineticAnimationInfoDB>
{
	public AnimationCurve globalPosInfluenceWithIKWeight;

	public List<MoveAnimationInfo> moveAnimations = new List<MoveAnimationInfo>();

	public List<HitAnimationInfo> hitAnimations = new List<HitAnimationInfo>();

	public List<MoveAnimationInfo> serveMoveAnimations = new List<MoveAnimationInfo>();

	public List<HitAnimationInfo> serveHitAnimations = new List<HitAnimationInfo>();

	protected override void Init()
	{
		base.Init();
		if (hitAnimations == null)
		{
			hitAnimations = new List<HitAnimationInfo>();
		}
		if (moveAnimations == null)
		{
			moveAnimations = new List<MoveAnimationInfo>();
		}
		if (serveHitAnimations == null)
		{
			serveHitAnimations = new List<HitAnimationInfo>();
		}
		if (serveMoveAnimations == null)
		{
			serveMoveAnimations = new List<MoveAnimationInfo>();
		}
	}

	public MoveAnimationInfo GetMoveAnimationByEnum(MoveAnimationsStateEnum animEnum)
	{
		foreach (MoveAnimationInfo moveAnimation in moveAnimations)
		{
			if (moveAnimation.animatorStateName == animEnum.ToString())
			{
				return moveAnimation;
			}
		}
		return null;
	}

	public KineticAnimationInfo GetAnimation(string animationName)
	{
		foreach (MoveAnimationInfo moveAnimation in moveAnimations)
		{
			if (moveAnimation.animatorStateName == animationName)
			{
				return moveAnimation;
			}
		}
		foreach (HitAnimationInfo hitAnimation in hitAnimations)
		{
			if (hitAnimation.animatorStateName == animationName)
			{
				return hitAnimation;
			}
		}
		foreach (MoveAnimationInfo serveMoveAnimation in serveMoveAnimations)
		{
			if (serveMoveAnimation.animatorStateName == animationName)
			{
				return serveMoveAnimation;
			}
		}
		foreach (HitAnimationInfo serveHitAnimation in serveHitAnimations)
		{
			if (serveHitAnimation.animatorStateName == animationName)
			{
				return serveHitAnimation;
			}
		}
		return null;
	}

	public KineticAnimationsStateEnum GetEnumForAnimation(KineticAnimationInfo anim)
	{
		foreach (object value in Enum.GetValues(typeof(KineticAnimationsStateEnum)))
		{
			if (value.ToString() == anim.animatorStateName)
			{
				return (KineticAnimationsStateEnum)value;
			}
		}
		return KineticAnimationsStateEnum.HopLeftShort;
	}

	public KineticAnimationInfo GetOrCreateAnimationByEnum(KineticAnimationsStateEnum animEnum)
	{
		foreach (MoveAnimationsStateEnum value in Enum.GetValues(typeof(MoveAnimationsStateEnum)))
		{
			if (value.ToString() == animEnum.ToString())
			{
				return GetOrCreateMoveAnimationByEnum(value);
			}
		}
		foreach (HitAnimationsStateEnum value2 in Enum.GetValues(typeof(HitAnimationsStateEnum)))
		{
			if (value2.ToString() == animEnum.ToString())
			{
				return GetOrCreateHitAnimationByEnum(value2);
			}
		}
		foreach (ServeMoveAnimationsStateEnum value3 in Enum.GetValues(typeof(ServeMoveAnimationsStateEnum)))
		{
			if (value3.ToString() == animEnum.ToString())
			{
				return GetOrCreateServeMoveAnimationByEnum(value3);
			}
		}
		foreach (ServeHitAnimationsStateEnum value4 in Enum.GetValues(typeof(ServeHitAnimationsStateEnum)))
		{
			if (value4.ToString() == animEnum.ToString())
			{
				return GetOrCreateServeHitAnimationByEnum(value4);
			}
		}
		return null;
	}

	public MoveAnimationInfo GetOrCreateMoveAnimationByEnum(MoveAnimationsStateEnum animEnum)
	{
		foreach (MoveAnimationInfo moveAnimation in moveAnimations)
		{
			if (moveAnimation.animatorStateName == animEnum.ToString())
			{
				return moveAnimation;
			}
		}
		MoveAnimationInfo moveAnimationInfo = new MoveAnimationInfo();
		moveAnimationInfo.animatorStateName = animEnum.ToString();
		moveAnimations.Add(moveAnimationInfo);
		return moveAnimationInfo;
	}

	public HitAnimationInfo GetOrCreateHitAnimationByEnum(HitAnimationsStateEnum animEnum)
	{
		foreach (HitAnimationInfo hitAnimation in hitAnimations)
		{
			if (hitAnimation.animatorStateName == animEnum.ToString())
			{
				return hitAnimation;
			}
		}
		HitAnimationInfo hitAnimationInfo = new HitAnimationInfo();
		hitAnimationInfo.animatorStateName = animEnum.ToString();
		hitAnimations.Add(hitAnimationInfo);
		return hitAnimationInfo;
	}

	public MoveAnimationInfo GetOrCreateServeMoveAnimationByEnum(ServeMoveAnimationsStateEnum animEnum)
	{
		foreach (MoveAnimationInfo serveMoveAnimation in serveMoveAnimations)
		{
			if (serveMoveAnimation.animatorStateName == animEnum.ToString())
			{
				return serveMoveAnimation;
			}
		}
		MoveAnimationInfo moveAnimationInfo = new MoveAnimationInfo();
		moveAnimationInfo.animatorStateName = animEnum.ToString();
		serveMoveAnimations.Add(moveAnimationInfo);
		return moveAnimationInfo;
	}

	public HitAnimationInfo GetOrCreateServeHitAnimationByEnum(ServeHitAnimationsStateEnum animEnum)
	{
		foreach (HitAnimationInfo serveHitAnimation in serveHitAnimations)
		{
			if (serveHitAnimation.animatorStateName == animEnum.ToString())
			{
				return serveHitAnimation;
			}
		}
		HitAnimationInfo hitAnimationInfo = new HitAnimationInfo();
		hitAnimationInfo.animatorStateName = animEnum.ToString();
		serveHitAnimations.Add(hitAnimationInfo);
		return hitAnimationInfo;
	}
}
